﻿using System.ComponentModel.DataAnnotations;

namespace iOSClub.WebAPI.Models.Users;

public class MemberModel
{
    [Key] public int Key { get; set; }

    public MemberModel()
    {
        UserName = "";
        Id = "";
        Academy = "";
        PoliticalLandscape = "";
        Gender = "";
    }

    public MemberModel(SignUpModel model)
    {
        UserName = model.UserName;
        Academy = model.Academy;
        PoliticalLandscape = model.PoliticalLandscape;
        Gender = model.Gender;
        Id = model.Id;
    }

    /// <summary>
    /// 姓名
    /// </summary>
    public string UserName { get; set; }

    /// <summary>
    /// 学号
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 学院
    /// </summary>
    public string Academy { get; set; }

    /// <summary>
    /// 政治面貌
    /// </summary>
    public string PoliticalLandscape { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    public string Gender { get; set; }

    /// <summary>
    /// President : 社长,副社长,秘书长
    /// TechnologyMinister : 科技部部长/副部长
    /// TechnologyMember : 科技部成员
    /// PracticalMinister : 实践交流部部长/副部长
    /// PracticalMember : 实践交流部成员
    /// NewMediaMinister : 新媒体部部长/副部长
    /// NewMediaMember : 新媒体部成员
    /// Member : 普通成员
    /// </summary>
    public string Identity { get; set; } = "Member";

    public override bool Equals(object? obj)
    {
        if (obj is not MemberModel model) return false;
        return Key == model.Key;
    }

    protected bool Equals(MemberModel other)
    {
        return Key == other.Key && UserName == other.UserName && Id == other.Id && Academy == other.Academy &&
               PoliticalLandscape == other.PoliticalLandscape && Gender == other.Gender && Identity == other.Identity;
    }
}